package com.huawei.hms.framework.network.restclient;

import com.huawei.hms.framework.network.restclient.ExecutorSubmitAdapterFactory.ExecutorSubmit;
import java.io.IOException;

class ExecutorSubmitAdapterFactory$ExecutorSubmit$1 implements ResultCallback<T> {
    final /* synthetic */ ExecutorSubmit this$1;
    final /* synthetic */ ResultCallback val$responseCallback;

    ExecutorSubmitAdapterFactory$ExecutorSubmit$1(ExecutorSubmit executorSubmit, ResultCallback resultCallback) {
        this.this$1 = executorSubmit;
        this.val$responseCallback = resultCallback;
    }

    public void onResponse(final Response<T> response) {
        this.this$1.executor.execute(new Runnable() {
            public void run() {
                if (ExecutorSubmitAdapterFactory$ExecutorSubmit$1.this.this$1.isCanceled()) {
                    ExecutorSubmitAdapterFactory$ExecutorSubmit$1.this.val$responseCallback.onFailure(new IOException("canceled"));
                } else {
                    ExecutorSubmitAdapterFactory$ExecutorSubmit$1.this.val$responseCallback.onResponse(response);
                }
            }
        });
    }

    public void onFailure(final Throwable th) {
        this.this$1.executor.execute(new Runnable() {
            public void run() {
                ExecutorSubmitAdapterFactory$ExecutorSubmit$1.this.val$responseCallback.onFailure(th);
            }
        });
    }
}
